﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace markdown_picture_packer.common.utils
{
    public class FrontUtil
    {
        //设置组件在另一个组件的右边
        public static void OnRight(Control c1, Control c2, int space)
        {
            c1.Location = new Point(c2.Location.X + c2.Width + space, c2.Location.Y);
        }
        //设置组件在另一个组件的下边
        public static void OnBottom(Control c1, Control c2, int space)
        {
            c1.Location = new Point(c2.Location.X, c2.Location.Y + c2.Height + space);
        }
        //获取填充宽度
        public static int GetFillWidth(int pWidth, params Control[] c)
        {
            return pWidth - c.Sum(item => item.Width);
        }
        //获取填充高度
        public static int GetFillHeight(int pHeight, params Control[] c)
        {
            return pHeight - c.Sum(item => item.Height);
        }
        //获取视觉上真实的宽度
        public static int GetRealWidth(int width)
        {
            return width - 18;
        }
        //获取视觉上真实的高度
        public static int GetRealHeight(int height)
        {
            return height - 40;
        }
    }
}
